package bg.vet.clinic.beans;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.ActionEvent;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.apache.commons.collections.*;
import org.apache.commons.beanutils.PropertyUtils;

import bg.vet.clinic.entity.User;

@ManagedBean
@SessionScoped
public class LoginBean {
	
	private String username;
	private String password;
	private String warnþing;
	
	public String getUsername() {
		EntityManagerFactory factory = Persistence.createEntityManagerFactory("Vet");
		User u = factory.createEntityManager().find(User.class, 1);
		System.out.println(u.getName());
		System.out.println(u.getUsername());
		System.out.println(u.getPassword());
		return username;
	}
	//test
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	public String getWarnþing() {
		return warnþing;
	}
	public void setWarnþing(String warnþing) {
		this.warnþing = warnþing;
	}
	public void login(ActionEvent event){
		System.out.println("Login®");
	}
	

}
